# SOURCE_DIR=src
# BUILD_DIR=build
# TEST_DIR=test
# HEADERS:=${ls ${SOURCE_DIR}/*.h*}
# SOURCES:=${ls ${SOURCE_DIR}/*.[c,y,l]*}
JUNK=parser.output parser.tab.cpp scanner.yy.c

all: error.o trans.o vartab.o types.o properties.o parser.tab.o
	g++ error.o trans.o vartab.o types.o parser.tab.o properties.o -lfl -o compilador

scanner.yy.c: scanner.lex
	flex --lex-compat --outfile scanner.yy.c scanner.lex

parser.tab.o: parser.ypp parser.hpp scanner.yy.c
	bison --verbose parser.ypp
	g++ -Wall -c parser.tab.cpp -lfl

error.o: error.cpp error.hpp parser.hpp
	g++ -Wall -c error.cpp

trans.o: trans.cpp trans.hpp types.hpp
	g++ -Wall -c trans.cpp

vartab.o: vartab.cpp vartab.hpp types.hpp
	g++ -Wall -c vartab.cpp

types.o: types.cpp types.hpp
	g++ -Wall -c types.cpp

properties.o: properties.cpp properties.hpp
	g++ -Wall -c properties.cpp

.PHONY: clean
clean:
	rm *.o
	rm $(JUNK)

clean-all: clean
	rm compilador
